package com.eos.control.action.activity;

import java.util.ArrayList;
import java.util.List;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.DataCacheUtil;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysActivty;
import com.eos.orm.mybatis.model.SysCustomer;

public class EditActivityAction extends AbstractBaseAction {
	private static final long serialVersionUID = 7464999837195523128L;
    private Integer activtyId;
	private SysActivty activity;
	private List<SysCustomer> customerList;
	
    public void setActivtyId(Integer activtyId) {
		this.activtyId = activtyId;
	}

	public SysActivty getActivity() {
		return activity;
	}

	public List<SysCustomer> getCustomerList() {
		return customerList;
	}

	@Override
	public String execute() {
		try {
			 SysActivityBusinessService sabs = new SysActivityBusinessService();
			 activity = sabs.getSysActivityPrimaryKey(activtyId);
			 List<SysCustomer> cList = DataCacheUtil.getAllSysCustomer();
				List<SysCustomer> rtnList = null;
				if(null != cList){
					rtnList = new ArrayList<SysCustomer>();
					for(SysCustomer c : cList){
						if("0".equals(c.getCustomerType())){
							rtnList.add(c);
						}
					}
					customerList = rtnList;
				}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
